package com.ruoyi.system.provider;

import com.ruoyi.system.domain.TbAppCatalog;
import org.apache.ibatis.jdbc.SQL;

public class TbAppCatalogSqlProvider {

    public String insertSelective(TbAppCatalog record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("tb_app_catalog");
        
        if (record.getPackageName() != null) {
            sql.VALUES("package_name", "#{packageName,jdbcType=VARCHAR}");
        }
        
        if (record.getAppName() != null) {
            sql.VALUES("app_name", "#{appName,jdbcType=VARCHAR}");
        }
        
        if (record.getDevSupplier() != null) {
            sql.VALUES("dev_supplier", "#{devSupplier,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageType() != null) {
            sql.VALUES("package_type", "#{packageType,jdbcType=INTEGER}");
        }
        
        if (record.getLastUpdate() != null) {
            sql.VALUES("last_update", "#{lastUpdate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getLastVersion() != null) {
            sql.VALUES("last_version", "#{lastVersion,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNumber() != null) {
            sql.VALUES("record_number", "#{recordNumber,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("remark", "#{remark,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getLogoImg() != null) {
            sql.VALUES("logo_img", "#{logoImg,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("status", "#{status,jdbcType=INTEGER}");
        }
        
        if (record.getDownloadCount() != null) {
            sql.VALUES("download_count", "#{downloadCount,jdbcType=INTEGER}");
        }
        
        if (record.getFileSize() != null) {
            sql.VALUES("file_size", "#{fileSize,jdbcType=DOUBLE}");
        }
        
        if (record.getMinOsVer() != null) {
            sql.VALUES("min_os_ver", "#{minOsVer,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateBy() != null) {
            sql.VALUES("create_by", "#{createBy,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.VALUES("update_by", "#{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(TbAppCatalog record) {
        SQL sql = new SQL();
        sql.UPDATE("tb_app_catalog");
        
        if (record.getPackageName() != null) {
            sql.SET("package_name = #{packageName,jdbcType=VARCHAR}");
        }
        
        if (record.getAppName() != null) {
            sql.SET("app_name = #{appName,jdbcType=VARCHAR}");
        }
        
        if (record.getDevSupplier() != null) {
            sql.SET("dev_supplier = #{devSupplier,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageType() != null) {
            sql.SET("package_type = #{packageType,jdbcType=INTEGER}");
        }
        
        if (record.getLastUpdate() != null) {
            sql.SET("last_update = #{lastUpdate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getLastVersion() != null) {
            sql.SET("last_version = #{lastVersion,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNumber() != null) {
            sql.SET("record_number = #{recordNumber,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("remark = #{remark,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getLogoImg() != null) {
            sql.SET("logo_img = #{logoImg,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("status = #{status,jdbcType=INTEGER}");
        }
        
        if (record.getDownloadCount() != null) {
            sql.SET("download_count = #{downloadCount,jdbcType=INTEGER}");
        }
        
        if (record.getFileSize() != null) {
            sql.SET("file_size = #{fileSize,jdbcType=DOUBLE}");
        }
        
        if (record.getMinOsVer() != null) {
            sql.SET("min_os_ver = #{minOsVer,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.SET("update_by = #{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}